package net.towee.client.xmpp;

import com.calclab.emite.core.client.conn.XmppConnection;
import com.calclab.emite.core.client.events.EmiteEventBus;
import com.calclab.emite.core.client.events.EventBusFactory;
import com.calclab.emite.core.client.services.Services;
import com.calclab.emite.core.client.services.gwt.GWTServices;
import com.calclab.emite.core.client.xmpp.resource.ResourceBindingManager;
import com.calclab.emite.core.client.xmpp.session.IMSessionManager;
import com.calclab.emite.core.client.xmpp.session.XmppSession;
import com.google.gwt.inject.client.AbstractGinModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;

public class XMPPModule extends AbstractGinModule {

    @Override
    protected void configure() {
    	bind(Services.class).to(GWTServices.class).in(Singleton.class);
		bind(XmppConnection.class).to(ToweeXmppConnection.class).in(Singleton.class);
		bind(XmppSession.class).to(ToweeXmppSession.class).in(Singleton.class);
		bind(IMSessionManager.class).in(Singleton.class);
		bind(ResourceBindingManager.class).in(Singleton.class);
    }

    @Provides
    @Singleton
    EmiteEventBus provideEmiteEventBus() {
	return EventBusFactory.create("emite");
    }
}
